/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.scene.service.api;

import com.koron.common.bean.StaffBean;
import com.koron.common.domain.DataBean;
import com.koron.scene.bean.CalibrationView;
import com.koron.scene.domain.DeviceCalibration;
import com.koron.scene.domain.DeviceCalibrationRelation;
import org.springframework.web.multipart.MultipartFile;
import org.swan.bean.MessageBean;

import java.util.List;

public interface DeviceCalibrationService {

    /**
     * fetch all calibration in the given condition
     * @param responsibleEmployeeName
     * @param calibrationCorp
     * @param status
     * @param start
     * @param rows
     * @return
     */
    DataBean<DeviceCalibration> fetchCalibrations(String corpCode, String title, String responsibleEmployeeName, String calibrationCorp, Integer status, Integer start, Integer rows,String keyword);


    /**
     * query the one whose id is the given
     * @param id
     * @return
     */
    DeviceCalibration fetchOne(String id);


    /**
     * delete calibration in batch
     * @param idList
     * @return
     */
    Boolean batchDetele(List<String> idList);

    /**
     * write calibration
     * @return
     */
    MessageBean<String> persist(DeviceCalibration deviceCalibration);


    /**
     * save relation between calibration and device
     * @param relation
     * @return
     */
    Integer saveCalibrationRelation(DeviceCalibrationRelation relation);


    /**
     * fetch calibration result
     * @param deviceCalibrationId
     * @return
     */
    DataBean<CalibrationView> fetchDeviceInCalibration(String corpCode, String responsibleEmployeeCode, String deviceCalibrationId, Integer start, Integer rows);

    /**
     * 检验记录下存在的未添加设备
     * @param corpCode 水司code
     * @param responsibleEmployeeCode 责任人code
     * @param deviceCalibrationId 检验记录id
     * @param deviceIds 列表中已存在的设备id集合
     * @param start
     * @param pageSize
     * @return
     */
    DataBean<CalibrationView> fetchAllDeviceInCalibration(String corpCode, String responsibleEmployeeCode, String deviceCalibrationId,String deviceIds, Integer start, Integer pageSize);

    /**
     * upload attachment
     * @param deviceCalibrationId
     * @param files
     * @return
     */
    Boolean uploadCalibrationAttachment(String deviceCalibrationId, String delFileAddress, String keepFileAddress, MultipartFile[] files);


    /**
     * get calibration attachment
     * @param deviceCalibrationId
     * @return
     */
    List<String> getCalibrationAttachment(String deviceCalibrationId);

    MessageBean submit(StaffBean user, DeviceCalibration deviceCalibration);

    /**
     * 删除检查明细数据
     * @param corpCode 水司code
     * @param deviceCalibrationId 检验记录id
     * @param deviceId 设备id
     * @return
     */
    MessageBean<Integer> deleteCalibrationRelation(String corpCode, String deviceCalibrationId, String deviceId);

    /**
     * 添加检查明细数据
     * @param corpCode 水司code
     * @param deviceCalibrationId 检验记录id
     * @param deviceIds 设备id集合
     * @return
     */
    MessageBean<Integer> addCalibrationRelation(String corpCode, String deviceCalibrationId, String deviceIds);

    List<DeviceCalibration> exportList(String corpCode, String title, String responsibleEmployeeName, String calibrationCorp, Integer status);

    CalibrationView fetchOneDeviceInCalibration(String corpCode, String responsibleEmployeeCode, String deviceCalibrationId, String deviceId);

}
